#include "messageuserlistitem.h"
#include "ui_messageuserlistitem.h"
#include "customlabel.h"

messageUserListItem::messageUserListItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::messageUserListItem)
{
    ui->setupUi(this);

}

messageUserListItem::~messageUserListItem()
{
    delete ui;
}

void messageUserListItem::setInfo(QString msg, QPixmap copyPixmap)
{
    ui->avatar->setPixmap(copyPixmap);
    ui->avatar->setScaledContents(true);
    ui->messages->setText(msg);
}

void messageUserListItem::setInfo(QPixmap imageMsg,QString imageName, QPixmap copyPixmap)
{
    ui->avatar->setPixmap(copyPixmap);
    ui->avatar->setScaledContents(true);
    ui->messages->setImageMsg(imageMsg);//显示图片在消息框
    ui->messages->setImage(imageName);//设置customlabel类双击显示图片
}

void messageUserListItem::setSendMsgError()
{
    QPixmap pixmap(":/images/sendmsg_error.png");
    ui->icon->setPixmap(pixmap.scaled(ui->icon->size(),Qt::KeepAspectRatio, Qt::SmoothTransformation));
    ui->icon->setScaledContents(true);
}


